<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');

            $table->integer('store_id')->unsigned(); // 店铺 ID
            $table->integer('class_id')->unsigned(); // 全局大分类 ID
            $table->integer('category_id')->unsigned(); // 分类 ID
            $table->integer('parent_id')->unsigned(); //  ID

            $table->boolean('grant_status')->default(false); // true：要求授权

            $table->string('name'); // 商品名称

            $table->integer('brand_id')->unsigned(); // 品牌 ID

            $table->decimal('original_price', 10, 2); // 原始价格、批发价

            $table->integer('province_id')->unsigned(); // 省、直辖市 ID
            $table->integer('city_id')->unsigned(); // 市县 ID
            $table->integer('country_id')->unsigned(); // 乡村镇 ID

            $table->integer('minimum_order')->unsigned(); // 最小起订量
            $table->string('cn'); // 货号

            $table->decimal('weight'); // 重量

            $table->tinyInteger('display'); // 展示权限
            $table->boolean('sell_status'); // 是否上架
            $table->boolean('recommend_status'); // 是否推荐

            $table->mediumText('detail'); // 商品详细描述

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('goods');
    }
}
